/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.latesis.web.controller;

import java.io.IOException;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author acabrera
 */
@ManagedBean(name="login")
@SessionScoped
public class LoginController implements Serializable{
    public void login(){
        System.out.println("paso por aqui");
        FacesContext context = FacesContext.getCurrentInstance();
        HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
        String navigateString = "/admin/AdminHome.xhtml";
        try {
            context.getExternalContext().redirect(request.getContextPath() + navigateString);
        } catch (IOException ex) {
            Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, null, ex);
            
            context.addMessage(null, new FacesMessage("Error!", "Exception occured"));
        }
    }
}
